package cuShapes;

import java.awt.*;

import palette.CurrentColor;


/***********************************************************
*  CurrentShape has a method to new a cuShape.PQShape based
*  on the state of its local variable selectedShape.  This
*  variable is updated by actionHandlers.ShapeSelector
***********************************************************/
public class CurrentShape {

	private static final long serialVersionUID = 1L;
	
	/********************************************
	 *  The literal name of the shape to be created
	 *  starting with a capitol letter. 
	 */
	private static String selectedShape = "Box";

	/**********************************************
	 *   CONSTRUCTORS
	**********************************************/
	protected CurrentShape(){
		
	}

	/**********************************************
	 *   Set currentShape to new instance of a
	 *     PQShape
	 *   This is called by the shape selection buttons. 
	 *     
	 * @param s String that is the name of the new 
	 *    shape to make. 
	 **********************************************/
	public static void setSelectedShape(String s) {
		selectedShape = s;
	}
	
	/****************************************************
	 *  This gets called when we are drawing a new shape
	 *  @param Point that represents the topleft point of
	 *    the shape we want to draw. 
	 **************************************************/
	public static PQShape getNewShape(Point centerPoint){
		if (selectedShape.equals("Box")) {
			return new Box(centerPoint, CurrentColor.getInstance());
		}
		else if (selectedShape.equals("Ellipse")) {
			return new Ellipse(centerPoint, CurrentColor.getInstance());
		}
		else{
			System.out.println(selectedShape +" is an unknown Shape" );
			return new Box(centerPoint, CurrentColor.getInstance());
		}
	}

}
